package homework3.exp1;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author fengq
 */
public class Test1 {
    public static void main(String[] args) {
        try {
            // 创建一个FileReader对象
            FileReader fr = new FileReader("D:\\Hello.txt");
            // 创建一个BufferedReader对象
            BufferedReader br = new BufferedReader(fr);
            // 读一行数据
            String line = br.readLine();
            while(line != null) {
                System.out.println(line);
                line = br.readLine();
            }
            // 关闭流
            br.close();
            fr.close();
        } catch(IOException e) {
            System.out.println("文件不存在！");
        }
    }
}
